#include <bits/stdc++.h>

using namespace std;

const int N = 110;

int t, n;

int main()
{
    cin >> t;
    while (t--)
    {
        cin >> n;
        int m = INT_MAX, cnt = 0;
        for (int i = 0; i < n; i++)
        {
            int a;
            cin >> a;
            if (a < m)
            {
                m = a;
                cnt = 1;
            }
            else if (a == m)
            {
                cnt++;
            }
        }
        cout << n - cnt << endl;
    }
    return 0;
}